package io.fft.flight.common.handler.airlinesorder.ho;

import com.microsoft.playwright.*;
import io.fft.flight.common.handler.airlinesorder.AirlinesOrderHandler;
import io.fft.flight.common.utils.flightHttp.reponse.BaseResVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.stereotype.Component;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestTemplate;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;

/**
 * 吉祥
 */
@Slf4j
@Component
public class HOAirlinesOrderHandler extends AbstractAirlinesOrderHandler {

    @Resource
    private JuneyaoairConfig juneyaoairConfig;
    @Resource
    private RestTemplate restTemplate;

    /**
     * {
     *     "arrCity": "三亚",
     *     "sendCity": "上海",
     *     "directType": "D",
     *     "flightType": "OW",
     *     "tripType": "D",
     *     "arrCode": "SYX",
     *     "sendCode": "SHA",
     *     "departureDate": "2024-08-09",
     *     "returnDate": "2024-08-11",
     *     "queryType": "",
     *     "passengerType": "ADT",
     *     "blackBox": "",
     *     "ffpId": 27441237,
     *     "ffpCardNo": "6966710063",
     *     "loginKeyInfo": "7F7F4399AA888E5D4A0B100A197371D0",
     *     "channelCode": "MWEB",
     *     "clientVersion": "2.3.9",
     *     "versionCode": "23900"
     * }
     */
    @Override
    public void newOrder() {
        /*MultiValueMap<String, Object> body = new LinkedMultiValueMap<>();
        body.put("arrCity", "三亚");
        body.put("sendCity", "上海");
        body.put("directType","D");
        body.put("flightType", "OW");
        body.put("tripType","D");
        body.put("arrCode","SYX");
        body.put("sendCode", "SHA");
        body.put("departureDate","2024-08-09");
        body.put("returnDate", "2024-08-11");
        body.put("queryType", "");
        body.put("passengerType", "ADT");
        body.put("blackBox", "");
        body.put("ffpId", 27441237);
        body.put("ffpCardNo", "6966710063");
        body.put("loginKeyInfo", "7F7F4399AA888E5D4A0B100A197371D0");
        body.put("channelCode", "MWEB");
        body.put("clientVersion", "2.3.9");
        body.put("versionCode", "23900");
        HttpHeaders headers = new HttpHeaders();
        headers.add("Channelcode",juneyaoairConfig.getChannelcode());
        headers.add("Clientversion",juneyaoairConfig.getClientversion());
        headers.add("Versioncode",juneyaoairConfig.getVersioncode());
        headers.add("User-agent","Mozilla/5.0 (iPhone; CPU iPhone OS 16_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.6 Mobile/15E148 Safari/604.1");
        HttpEntity<MultiValueMap<String, Object>> formEntity = new HttpEntity<>(headers,);
        formEntity.
        restTemplate.exchange(juneyaoairConfig.getUrl() + "/v2/flight/AvFare", HttpMethod.POST,)*/
    }
}
